﻿using System;
using UnityEngine;
using System.Collections;

public static class WindowExport
{
//    public static int Find(string pathName, int parWindowId)
//    {
//        GameObject parObj = WindowMgr.Instance.Get(parWindowId);
//        Transform trans = parObj.transform.FindRecursive(pathName);
//        if (trans == null)
//        {
//            return -1;
//        }
//        return WindowMgr.Instance.Add(trans.gameObject);
//    }

//    public static int UseLastWindow()
//    {
//        return WindowMgr.Instance.IncWindow();
//    }

    public static int TryCreate(int parWindowId, string pathName)
    {
        GameObject parObj = WindowMgr.Instance.Get(parWindowId);
        Transform trans = parObj.transform.Find(pathName);
        if (trans == null)
        {
            return -1;
        }
        return WindowMgr.Instance.Add(trans.gameObject);
    }
}
